package huang.com.android.simpleplay;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class SimplayActivity extends AppCompatActivity {
    private Button start = null;
    private Button stop = null;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_simplay);
        start = (Button) findViewById(R.id.Start);
        start.setOnClickListener(startIt);
        stop = (Button) findViewById(R.id.Stop);
        stop.setOnClickListener(stopIt);

    }

    private View.OnClickListener startIt = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startService(new Intent(SimplayActivity.this,Music.class));
        }
    };

    private View.OnClickListener stopIt = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            stopService(new Intent(SimplayActivity.this,Music.class));
            finish();
        }
    };

}
